var http = require('http')

var options = {
	hostname:"www.baidu.com",
	port:80
}
var datas = ''
var req = http.request(options,function(res){
	res.setEncoding('utf-8')
	res.on('data',function(chunk){
		 console.log(chunk.toString())
		 datas += chunk
	})
	console.log(res.statusCode);
})
req.on("error",function(err){
    console.log(err.message);
});
req.end();


var server=new http.Server();

server.on("request",function(req,res){
    res.writeHead(200,{
        "content-type":"text/plain"
    });
    res.write(datas);
    res.end();
});
server.listen(3000);
















